<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <title>稻道工厂</title>
    <link rel="stylesheet" href="__PUBLIC__css/reset.css" />
    <link rel="stylesheet" href="__PUBLIC__css/store.css" />
</head>
<body>
<div class="layout">

    <!--header-->
    <div class="wrapper">
        <div class="header">
            <a class="s_preson" href="{:U('Users/myOrder')}" target="_blank"> < </a>
            <div class="store">
                <span>订单详情</span>
            </div>
        </div>
    </div>

    <form action="{:U('Order/orderUpdate')}" method="post">
    <div class="address">
        <p class="method-title">收货人信息</p>
            <ul class="addForm">
                <li><span>配送方式：</span>{$orderInfo.shipping_type_b}</li>
                <li><span>收货人：</span>{$orderInfo.consignee}</li>
                <li><span>联系方式：</span>{$orderInfo.mobile}</li>
                <li><span>收货地址：</span>{$orderInfo.cityName}/{$orderInfo.zoneName} {$orderInfo.address}</li>
            </ul>

    </div>

    <ul class="main-content">
        <p class="method-title">订单信息</p>
        <volist name="orderGoods" id="vo">
            <li class="list-item">
                <div class="list-img">
                    <a href="###">
                        <img src="__UPLOAD__{$vo.thumb}" alt="" width="100"/>
                    </a>
                </div>
                <div class="list-content">
                    <a href="#"><h3 class="list-title">{$vo.name}</h3></a>
                    <p class="list-price"><em>单价：{$vo.shop_price}元</em>&nbsp;<i></i></p>
                    <p class="list-price"><em>{$vo.goods_number}件</em>&nbsp;<i></i></p>
                    <div class="list-add"><h3 class="list-title">{$vo.singlePriceCount}元</h3></div>
                </div>
            </li>
        </volist>
    </ul>

    <div class="method clearfix">
        <h2 class="method-title">付款方式：<b>{$orderInfo.pay_type_b}</b></h2>
        <h2 class="method-title">配送方式：<b>{$orderInfo.shipping_type_b}</b></h2>
        <h2 class="method-title">订单状态：<b>{$orderInfo.order_status_b}</b></h2>
        <div class="total">
            <p class="totalNum">总计：<em>￥{$goodsAmount}</em></p>
        </div>
        <if condition="$pay_status eq '2'">
            <div class="settlement">已付款(无需提交)</div>
        <else/>
            <if condition="$orderInfo[pay_type] eq '0'">
                <div class="settlement">货到付款(无需提交) </div>
            <else />
                <input type="text" name="pay_type" value="{$orderInfo.pay_type}" style="display:none;">
                <input type="text" name="order_sn" value="{$orderInfo.order_sn}" style="display:none;">
                <input type="text" name="goods_amount" value="{$goodsAmount}" style="display:none;">
                <input type="text" name="order_id" value="{$orderInfo.id}" style="display:none;">
                <div>
                    <input type="submit" value="去支付" class="settlement"/>
                </div>
            </if>
        </if>
    </div>
    </form>

</div>
</body>
</html>
<script type="text/javascript" src="__PUBLIC__js/zepto.min.js" ></script>
<script type="text/javascript">
    $(function(){
        (function(){
            //表单获取焦点和失去焦点
            var val;
            $('input[type=text]').focus(function(){
                val = $(this).val();
                $(this).val('');
            }).blur(function(){
                $(this).val(val);
            })

            //商品加减统计
            var listItem = $('.list-item');
            var listAdd  = listItem.find('.list-add');
            for(var i=0;i<listItem.length;i++){
                fnMain(listItem.eq(i));
            };

            function fnMain(quantityCur){
                var oPrev = quantityCur.find('.prev');
                var oNext  =   quantityCur.find('.next');
                var formInput =   quantityCur.find('input');

                var num=0;

                oPrev.click(function(){
                    if(num>0){
                        num--;
                    };
                    formInput.val(num);
                    var productID=oPrev.attr("data");
                    var number=num;
                    $.ajax({
                        url:"{:U('Order/updateNum')}",

                        type: 'POST',

                        data:{
                            productID:productID,
                            number:number
                        },

                        dataType: 'html',

                        timeout: 1000,

                        error: function(){alert('Error loading PHP document');},

                        success: function(result){
                            var one=result.split("/");
                            $("#cartNum").html(one[0]);
                            $("#cartPrice").html(one[1]);
                            $('#thisPrice'+productID).html(one[2]);
                        }

                    });
                });
                oNext.click(function(){
                    num++;
                    formInput.val(num);
                    var productID=oPrev.attr("data");
                    var number=num;
                    $.ajax({
                        url:"{:U('Order/updateNum')}",

                        type: 'POST',

                        data:{
                            productID:productID,
                            number:number
                        },

                        dataType: 'html',

                        timeout: 1000,

                        error: function(){alert('Error loading PHP document');},

                        success: function(result){
                            var one=result.split("/");
                            $("#cartNum").html(one[0]);
                            $("#cartPrice").html(one[1]);
                            $('#thisPrice'+productID).html(one[2]);
                        }

                    });
                });
            };
        })()
    });
</script>